import BaseMonsterSkill from "./BaseMonsterSkill";
import IBaseMonsterSkill from "./IBaseMonsterSkill";
import MonsterScript from "../../../component/MonsterScript";
import SkillEffect from "./SkillEffect";
import Game from "../../Game";





export default class MoreLifeZoom extends BaseMonsterSkill implements IBaseMonsterSkill {


    _times: number = 1;

    _curTimes: number = 0;

    _zoomScale: number;


    init(target: MonsterScript, skillId) {
        super.init(target, skillId);
 
        this._times = this._skillData.times ? this._skillData.times : this._times;
        this._target.addDieCb(this.dieCb.bind(this))
        this._zoomScale = 100 / (this._times + 1) * 0.01;
 
    }


    exec() {
        // console.log("ShieldSkill exec")


    }

    reset() {
        super.reset();
        this._curTimes = 0;
        this._target.sp3d.transform.localScaleX = 40;
        this._target.sp3d.transform.localScaleY = 40;
        this._target.sp3d.transform.localScaleZ = 40;
    }

    dieCb() {
        if (this._curTimes >= this._times) {
            return false;
        }
        else {
            this._curTimes++;
            this._target.resetHp();
            let scale = 40 * (1 - (this._zoomScale * this._curTimes));
            this._target.sp3d.transform.localScaleX = scale;
            this._target.sp3d.transform.localScaleY = scale;
            this._target.sp3d.transform.localScaleZ = scale;
            return true;
        }

    }

    destroy() {
        this._target.sp3d.transform.localScaleX = 40;
        this._target.sp3d.transform.localScaleY = 40;
        this._target.sp3d.transform.localScaleZ = 40;
        super.destroy();
    }





}